{% extends "./inc/base.html" %}
{% block style%}
<link rel="stylesheet" href="/static/admin/js/datepicker/bootstrap-datetimepicker.min.css" type="text/css">
{%endblock%}
{% block content %}
                <section class="vbox">
                    <header class="header bg-light dk">
                        <p>{{controller.meta_title}}</p>
                    </header>
                    <section class="scrollable wrapper">

                        <section class="panel panel-default">
                            <header class="panel-heading clearfix">
                                <ul class="nav nav-tabs pull-left ">
                                    <li class="active"><a  href="/{{ctx.controller}}/index">已安装的插件</a></li>
                                    <li class=""><a  href="/{{ctx.controller}}/uninstall">未安装的插件</a></li>
                                </ul>
                            </header>
                            <div class="row wrapper">

                                <div class="col-sm-9 m-b-xs">
                                    <div class="">
                                        <a class="btn btn-sm btn-info " href="/admin/ext/add">
                                            快速创建插件
                                        </a>
                                        <a class="btn btn-sm btn-info ajax-post" target-form="sort" href="/{{ctx.controller}}/sort">
                                            排序
                                        </a>
                                        <a class="btn btn-sm btn-info ajax-post" href="/admin/ext/setstatus/?status=1&pk=ext"  target-form="ids">
                                            启用
                                        </a>
                                        <a class="btn btn-sm btn-info ajax-post" href="/admin/ext/setstatus/?status=0&pk=ext" target-form="ids">
                                            禁用
                                        </a>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <div class="input-group pull-right">
                                        <input type="text" class="input-sm form-control" placeholder="Search">
                      <span class="input-group-btn">
                        <button class="btn btn-sm btn-default" type="button">Go!</button>
                      </span>
                                    </div>
                                </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped b-t b-light">
                                    <thead>
                                    <tr>
                                        <th style="width:20px;"><label class="checkbox m-n i-checks"><input type="checkbox"><i></i></label></th>
                                        <th style="width:80px;">排序</th>
                                        <th style="">插件名称</th>
                                        <th class="">插件目录</th>
                                        <!--<th class="">描述</th>-->
                                        <th class="">版本号</th>
                                        <th class="">作者</th>
                                        <th class="">安装时间</th>
                                        <th class="">状态</th>
                                        <th >操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {% for item in list %}
                                    <tr>
                                        <td><label class="checkbox m-n i-checks"><input class="ids" type="checkbox" name="ids" value="{{item.ext}}" ><i></i></label></td>
                                        <td><input class="form-control form-control-text sort" value="{{item.sort}}" name="sort" data-id="{{item.ext}}"/></td>
                                        <td>{{item.name}} <i data-title="{{item.description}}" data-placement="bottom" data-toggle="tooltip" class="fa fa-info-sign text-muted" data-original-title="" title=""><i class="fa fa-question-circle"></i></i></td>
                                        <td>{{item.ext}}</td>
                                        <!--<td>{{item.description}}</td>-->
                                        <td>{{item.version}}</td>
                                        <td>{{item.author}}</td>
                                        <td>{{item.installtime | moment('YYYY-MM-DD HH:mm')}}</td>
                                        <td>
                                            <a href="/admin/ext/setstatus/?ids={{item.ext}}&status={{1-item.status}}&pk=ext" class="active ajax-get" data-toggle="class">
                                                <i class="fa fa-check text-success {%if item.status %}text-active{%else%}text{%endif%}"></i>
                                                <i class="fa fa-times text-danger {%if item.status %}text{%else%}text-active{%endif%}"></i>
                                            </a>
                                        </td>
                                        
                                        <td>
                                            {%if item.isindex==1%}
                                            <a href="/ext/{{item.ext}}/index/index" target="_blank" class="text-info">访问</a>
                                            {%endif%}
                                           {%if item.isadm==1%}
                                            <a href="/ext/{{item.ext}}/admin/index" class="text-info">管理</a>
                                            {%endif%}
                                            {%if item.setting|strToJson|length >0 %}
                                            <a href="/ext/{{item.ext}}/admin/setting" class="text-info">设置</a>
                                            {%endif%}
                                            {%if item.ext != 'demo'%}
                                            <a href="/ext/{{item.ext}}/admin/reload/?ext={{item.ext}}" class="confirm ajax-get text-info">重载</a>
                                            <a href="/ext/{{item.ext}}/admin/uninstall/?ext={{item.ext}}" class="confirm ajax-get text-info">卸载</a>
                                            {%endif%}
                                        </td>

                                    </tr>
                                    {% else %}
                                    <tr><td colspan="7"><div class="alert alert-warning alert-block">
                                        <button data-dismiss="alert" class="close" type="button">×</button>
                                        <p>This would display if the 'item' collection were empty</p>
                                    </div></td></tr>

                                    {% endfor %}


                                    </tbody>
                                </table>
                            </div>
                            <footer class="panel-footer">
                                <div class="row">


                                    <div class="col-sm-12 text-right text-center-xs">
                                        {{pagerData | safe}}
                                    </div>
                                </div>
                            </footer>
                        </section>
                    </section>
                </section>

{% endblock %}
{% block script%}
<script src="/static/admin/js/parsley/parsley.min.js"></script>
<script src="/static/admin/js/parsley/parsley.extend.js"></script>
<script src="/static/admin/js/datepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<script src="/static/admin/js/datepicker/locales/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script>

{% endblock%}